<!DOCTYPE html>
<?php
    include("comprobar.php");
?>
<html lang="">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <link rel="stylesheet" href="css/style_admon.css">
    <script src="lib/jquery-1.11.2.min.js"></script>
</head>
<body>
    <div id="general">
        <?php
            include "administracion.php";
            include "admin-general.php";
        ?>
        <div id='datos'>
        <?php
            if (isset($_GET['cod-art'])&&isset($_GET['cod-prov'])) {
                $link = mysql_connect('localhost','root','')or die('No se pudo conectar: ' . mysql_error());
                mysql_select_db('bdproyecto') or die('No se pudo seleccionar la base de datos');
                $query = "DELETE FROM vende 
                WHERE cod_articulo=".$_GET['cod-art']." AND cod_proveedor=".$_GET['cod-prov']."";;
                $result = mysql_query($query); 

                if ($result) {
                echo"<script>
                    alert('Borrado Realizado Correctamente');
                </script>";
                } else {
                echo"<script>
                    alert('Tiene dependencias');
                </script>";
                  
                }
                mysql_close($link);

                header("refresh:0; url=ver-articulos.php?cod=".$_GET['cod-prov']."");
            }
        ?>
        </div>
    </div>
</body>
</html>
